﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ProtoGame.GameLib.Entities;
using Microsoft.Xna.Framework.Graphics;
using ProtoGame.GameLib;
using Microsoft.Xna.Framework.Content;

namespace ProtoGame.DescritoresContent
{
    public static class PGIMGTatu
    {
        private const ushort tileWidth = 48;
        private const ushort tileHeight = 64;

        public const byte StateParadoCima = 0;
        public const byte StateParadoDireita = 1;
        public const byte StateParadoBaixo = 2;
        public const byte StateParadoEsquerda = 3;
        public const byte StateAndandoCima = 4;
        public const byte StateAndandoDireita = 5;
        public const byte StateAndandoBaixo = 6;
        public const byte StateAndandoEsquerda = 7;

        public static Tileset CriarTileset(ContentManager content)
        {
            return new Tileset(content.Load<Texture2D>(@"Images\Sprites\Urso"), tileWidth, tileHeight);
        }

        public static Animator CriarAnimator()
        {
            Animator tatuAnim = new Animator();
            tatuAnim.AddStaticAnimation(StateParadoCima, 1);
            tatuAnim.AddStaticAnimation(StateParadoDireita, 4);
            tatuAnim.AddStaticAnimation(StateParadoBaixo, 7);
            tatuAnim.AddStaticAnimation(StateParadoEsquerda, 10);

            tatuAnim.AddAnimation(StateAndandoCima, 0, 1, SpriteEffects.None, TimeSpan.FromSeconds(1 / 10.0), true);
            tatuAnim.AddAnimation(StateAndandoDireita, 3, 4, SpriteEffects.None, TimeSpan.FromSeconds(1 / 10.0), true);
            tatuAnim.AddAnimation(StateAndandoBaixo, 6, 7, SpriteEffects.None, TimeSpan.FromSeconds(1 / 10.0), true);
            tatuAnim.AddAnimation(StateAndandoEsquerda, 9, 10, SpriteEffects.None, TimeSpan.FromSeconds(1 / 10.0), true);

            return tatuAnim;
        }
    }
}
